From: Sundeep Mediratta Date: Wed, 6 Nov 2024 02:47:34 +0000 (-0500) Subject: status/volume: Create global showOSD() method for StreamSlider X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~173^2^2~175 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9f8cb2fabafdb2b07427e78a2811f4dda054b9fe;p=gnome-shell.git status/volume: Create global showOSD() method for StreamSlider Abstract the Volume slider OSD display as a global method in the base class, so that can be reused in all derived classes without duplicating code. Part-of: --- diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index 0ba871bb3..330476358 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -276,6 +276,13 @@ const StreamSlider = GObject.registerClass({ return maxVolume / this._control.get_vol_max_norm(); } + + showOSD() { + const gicon = new Gio.ThemedIcon({name: this.getIcon()}); + const level = this.getLevel(); + const maxLevel = this.getMaxLevel(); + Main.osdWindowManager.show(-1, gicon, null, level, maxLevel); + } }); const OutputStreamSlider = GObject.registerClass( @@ -425,10 +432,7 @@ class VolumeIndicator extends SystemIndicator { if (result === Clutter.EVENT_PROPAGATE || item.mapped) return result; - const gicon = new Gio.ThemedIcon({name: item.getIcon()}); - const level = item.getLevel(); - const maxLevel = item.getMaxLevel(); - Main.osdWindowManager.show(-1, gicon, null, level, maxLevel); + item.showOSD(); return result; } });